In an application server or database environment which enables access by software applications to data in a database, typically the data retrieved from the database must be allocated in memory arrays or buffers before it can be accessed by the requesting application. However, in some environments, the arrays or buffers allocated in memory for the data can be very large, and can include unused or empty space. This can cause system performance problems, such as out-of-memory errors, and when a virtual machine such as a Java virtual machine is used, excessive thrashing of the virtual machine during garbage collection.